﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Data;

namespace AppBrowser
{
    /// <summary>
    /// Application Category Object
    /// </summary>
    public class AppCategoryItem
    {
        public string Name;
        public string Category_Id;
        
        // Icon Format
        private Icon _IconImg;
        public Icon IconImg
        {
            get { return _IconImg; }
            set { 
                  _IconImg = value;
                  _IconFile = null;
            }
        }

        // Path to icon, if set than load icon
        private string _IconFile;
        public string IconFile
        {
            get { return _IconFile; }
            set { 
                _IconFile = value;
                LoadIcon(_IconFile);
            }
        }

        /// <summary>
        /// New category
        /// </summary>
        public AppCategoryItem()
        {

        }

        /// <summary>
        /// Set category with icon
        /// </summary>
        /// <param name="name"></param>
        /// <param name="iconfile"></param>
        public AppCategoryItem(string name, string iconfile)
        {
            Name = name;
            IconFile = iconfile;
        }
       
        public AppCategoryItem(DataRow dr)
        {
            Name = dr["name"].ToString();
        }
              
        /// <summary>
        /// Get Icon  for Categories from IconFile Specified (.exe / .ico )
        /// </summary>
        /// <param name="IconFile"></param>
        /// <returns></returns>
        private void LoadIcon(string IconFile)
        {
                // IconImg= IconExtract.ExtractIconFromFile(IconFile);
        }

    }
}
